import 'dart:io';

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:yyshort/pages/payment/controller.dart';

class AppBarActions extends GetView<PaymentController> {
  const AppBarActions({super.key});

  @override
  Widget build(BuildContext context) {
    return TextButton(
      onPressed: () => Platform.isIOS
          ? controller.state.isNeedLoading.value
                ? null
                : controller.restorePurchases()
          : null,
      child: Container(
              decoration: BoxDecoration(
                gradient: LinearGradient(
                  begin: Alignment.centerLeft,
                  end: Alignment.centerRight,
                  colors: [Color(0xFFF4D288), Color(0xFFF8DEA5)],
                ),
                borderRadius: BorderRadius.circular(20),
              ),
              padding: EdgeInsets.symmetric(horizontal: 10, vertical: 8),
              child: Text('恢复'.tr, style: TextStyle(color: Colors.black)),
            )
          ,
    );
  }
}
